<script type='text/template' id='variant_line_items_autocomplete_stock_template'>

  <label><%= Spree.t(:select_stock) %></label>

  <table class="stock-levels table table-bordered" data-hook="stock-levels">
    <thead>
      <th><%= Spree.t(:name) %></th>
      <th class="text-center"><%= Spree.t(:count_on_hand) %></th>
      <th class="text-center"><%= Spree.t(:quantity) %></th>
      <th></th>
    </thead>
    <tbody>
      <tr>
        <td>{{variant.name}}</td>
        {{#if variant.track_inventory}}
          {{#if variant.is_orderable}}
            <td class="text-center">
              {{variant.total_on_hand}}
            </td>

            <td class="text-center">
              <input class="quantity form-control" id="variant_quantity" data-variant-id="{{variant.id}}" type="number" min="1" value="1">
            </td>
            <td class="actions actions-1 text-center">
              <button class="btn btn-sm btn-success add_variant with-tip" data-variant-id="{{variant.id}}" title="<%= Spree.t(:add) %>" data-action="add">
                 <%= svg_icon name: "add.svg", width: '16', height: '16' %>
              </button>
            </td>
          {{else}}
            {{#if variant.is_backorderable}}
              <td class="text-center">
                {{variant.total_on_hand}} (<%= Spree.t(:backorders_allowed) %>)
              </td>

              <td class="text-center">
                <input class="quantity form-control" id="variant_quantity" data-variant-id="{{variant.id}}" type="number" min="1" value="1">
              </td>
              <td class="actions actions-1 text-center">
                <button class="btn btn-sm btn-success add_variant with-tip" data-variant-id="{{variant.id}}" title="<%= Spree.t(:add) %>" data-action="add">
                   <%= svg_icon name: "add.svg", width: '16', height: '16' %>
                </button>
              </td>
            {{else}}
              <td class="text-center"><%= Spree.t(:out_of_stock) %></td>
              <td class="text-center">0</td>
              <td></td>
            {{/if}}
          {{/if}}
        {{else}}
          <td class="text-center"><%= Spree.t(:doesnt_track_inventory) %></td>
          <td class="text-center">
            <input class="quantity form-control" id="variant_quantity" data-variant-id="{{variant.id}}" type="number" min="1" value="1">
          </td>
          <td class="actions actions-1 text-center">
            <button class="btn btn-sm btn-success add_variant with-tip" data-variant-id="{{variant.id}}" title="<%= Spree.t(:add) %>" data-action="add">
              <%= svg_icon name: "add.svg", width: '16', height: '16' %>
            </button>
          </td>
        {{/if}}
      </tr>
    </tbody>
  </table>
</script>
